# -*- coding: utf-8 -*-
from datetime import timedelta

from utils.operators.spark_submit import SparkSubmitOperator

from jms.time_sensor.time_after_05_45 import time_after_05_45
from jms.dm.route.cainiao_new_version.dm_cainiao_route_push_data_dt_success import jms_dm__dm_cainiao_route_push_data_dt_success

jms_oracle__route_whole_monitor_dt = SparkSubmitOperator(
    conn_id='spark_route',
    task_id='jms_oracle__route_whole_monitor_dt',
    pool_slots=1,
    email=['zhangqinglin@jtexpress.com','yl_bigdata@yl-scm.com'],
    name='jms_oracle__route_whole_monitor_dt',
    driver_memory='4G' ,
    executor_memory='2G' ,
    executor_cores=2 ,
    num_executors=4 ,
    jars='hdfs:///route/package/graphframes-0.7.0-spark2.3-s_2.11.jar,hdfs:///route/package/common-1.0-SNAPSHOT.jar,hdfs:///route/package/ojdbc8.jar',
    java_class='com.yunlu.bigdata.jobs.route.export.RouteMonitor',
    application='hdfs:///route/package/route_monitor/original-jobs-1.0-SNAPSHOT.jar',
    application_args=['{{ execution_date | cst_ds }}'],
    execution_timeout=timedelta(hours=1)
)

jms_oracle__route_whole_monitor_dt << [
    time_after_05_45,
    jms_dm__dm_cainiao_route_push_data_dt_success
]
